package com.lib.utils;

import androidx.lifecycle.MutableLiveData;

public class LiveDataBus {
    public static final byte NONE = 0x00;
    public static final byte ON_CLICK_CMD = 0x1;
    public static final byte ON_CLICK_IMG = 0x2;

    private static final MutableLiveData<Data> sLiveData = new MutableLiveData<>();

    private LiveDataBus() {
    }

    public static MutableLiveData<Data> get() {
        return sLiveData;
    }

    public static class Data {
        public int cmd;
        public String comment;
        public Object obj;

        public Data(int cmd, String comment) {
            this(cmd, comment, null);
        }

        public Data(int cmd, String comment, Object obj) {
            this.cmd = cmd;
            this.comment = comment;
            this.obj = obj;
        }

        @Override
        public String toString() {
            return "Data{" +
                    "cmd=" + cmd +
                    ", comment='" + comment + '\'' +
                    ", obj=" + obj +
                    '}';
        }
    }
}